//
// Created by guanzhe on 15/10/13.
// Copyright (c) 2015 hefoni. All rights reserved.
//

#import "CommonSearchBar.h"
#import "UIColor+Extension.h"
#import "Macro.h"

@interface CommonSearchBar (){

}
@end

@implementation CommonSearchBar {

}




/**
 *  自定义控件自带的取消按钮的文字（默认为“取消”/“Cancel”）
 *
 *  @param title 自定义文字
 */
- (void)setCancelButtonTitle:(NSString *)title
{
    if(IsStringEmpty(title))
        return;
    NSArray *array = self.subviews;
    UIView *view = array.firstObject;
    for (UIView *searchButtons in view.subviews)
    {
        if ([searchButtons isKindOfClass:[UIButton class]])
        {
            UIButton *cancelButton = (UIButton*)searchButtons;
            [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            cancelButton.titleLabel.font = [UIFont systemFontOfSize: 14.0];
            [cancelButton setTitle:title forState:UIControlStateNormal];
            break;
        }
    }
}


@end